#include<stdio.h>
#include<malloc.h>
struct  cell{
	int x;
	struct cell *next; 
};
struct cell *build(void){
	struct cell *head,*tmp,*p;
	head=tmp=p=NULL;
	int n;
	head=(struct cell*)malloc(sizeof(struct cell));
	scanf("%d",&head->x);
	tmp=head;
	tmp->next=NULL;
	if(head->x==0)head=NULL;
	else{
	do{
		p=(struct cell*)malloc(sizeof(struct cell));
		scanf("%d",&p->x);
		tmp->next=p;
		tmp=p;
		tmp->next=NULL;
	}while(p->x!=0);
}
	return head;
}
struct cell* mid(struct cell *head){
	struct cell *p0,*p;
	int n=0,i,j=0;
	if(head==NULL)head==NULL;
	else{
	p=head;
	while(p!=NULL){
		p=p->next;
		n=n+1;
	}
	j=n/2;
	p0=head;
	while(j!=1){
		p0=p0->next;
		j--; 
	}
	head=p0;
}
	return head;
}
void print(struct cell *head){
	struct cell *p;
	printf("%d",head->x);
	p=head->next;
	while(p->x!=0){
		printf(" %d",p->x);
		p=p->next;
	}
}
void release(struct cell*head){
	struct cell *p;
	while(head!=NULL){
		p=head;
		head=p->next;
		free(p);
	}
}
int main(void) {
 struct cell* head,*half;
 head = build();
 half = mid(head);
 if(half!=NULL)
        print(half);
    else
        printf("NULL");
 release(head);
}
